import axios from 'axios'
import React, { useEffect, useState } from 'react'
import { Space, Table, Tag } from 'antd';
import { useNavigate } from 'react-router-dom';
const { Column, ColumnGroup } = Table;

function Cinema() {
  let navigator = useNavigate()
  const [count, setcount] = useState(0)
  const [page, setpage] = useState(1)
  const [data, setdata] = useState([])
  useEffect(() => {
    axios.get('http://localhost:3000/getmovespaly').then((data, err) => {
      console.log(data.data.data);
      console.log(data.data.count);
      setdata([...data.data.data])
    })
  }, [])
  return (
    <div>
      <Table dataSource={data}>
        <Column title="影院名称" dataIndex="name" key="name" />
        <Column title="地址" dataIndex="address" key="address" />
        <Column title="语种" dataIndex="language_id" key="language_id" render={(language_id) => (< Tag color="blue" >{language_id.name}</Tag>)} />
        <Column title="类型" dataIndex="palytype" key="palytype" render={(palytype) => (< Tag color="blue" >{palytype.name}</Tag>)} />
        <Column
          title="Action"
          key="action"
          render={(_, record) => (
            <Space size="middle">
              <a onClick={() => navigator('/cinema/film')}>Detailes</a>
              <a>Upd</a>
              <a>Del</a>
            </Space>
          )}
        />
      </Table>
    </div>
  )
}
export default Cinema